Xbasic

WORD_IN_COMMON_C Function

Syntax

Common_List as C = word_in_common_c(C list1, C list2, C delimiter)

Arguments

list1Character

A list of words.

list2Character

A second list of words.

delimiterCharacter

The character string that delimits words in each list.

Returns

Common_ListLogical

Returns the words found in both lists, separated by the delimiter string.

Description

Find the words in common between two lists of words, using a case-sensitive comparison.

Discussion

Returns a list of words in common between List1 and List2 using a case-sensitive comparison. The words in List1 and List2 are separated by Delimiter. This function is typically used to find a list of words that two strings have in common.

The following Xbasic script defines two lists of CR-LF-delimited words, then finds the common words.

dim list1 as c =<<%a% 
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
%a%

dim list2 as c =<<%a%
Monday
Thursday
friday
sunday
%a%

? word_in_common_c(list1, list2, crlf())
= Monday
Thursday

See Also